package dm.ast.model.gen;

import dm.ast.DmASTNode;
import dm.ast.DmHint;
import dm.repository.DmHintsInfo;
import test.utility.Randomly;

public class HintsGen extends ASTGenBase{

    static int MAX_HINT_COUNT = 6;

    @Override
    public DmASTNode gen(int astLevel, int wid_t, int dep_t) {
        DmHint dmHint = new DmHint();
        return dmHint;
    }

    public static boolean finishGen(DmASTNode node){
        DmHint dmHint = (DmHint)node;
        if(DmHintsInfo.hintsParaCnt != 0){
            int hintCnt = (int) Randomly.getNotCachedInteger(0 , MAX_HINT_COUNT);
            for (int i = 0; i < hintCnt; i++) {
                dmHint.addHint(DmHintsInfo.getRandom());
            }
        }
        return true;
    }
}
